<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateTagRecord extends Migrator
{
    public function up(){
        $table = $this->table('tag_record');
        $table->addColumn('user_id','integer',['limit'=>10,'comment'=>'用户id'])
//            ->addColumn('tag_id','integer',['limit'=>10])
//            ->addColumn('score','integer',['limit'=>10,'default'=>0,'comment'=>'标签id对应的分值'])
            ->addColumn('tagid_score','text',['comment'=>'评价的数据'])
            ->addColumn('op_user_id','integer',['limit'=>10,'comment'=>'评价人用户id'])
            ->addForeignKey('user_id','user','id',['delete'=>'CASCADE'])
            ->addForeignKey('op_user_id','user','id',['delete'=>'CASCADE'])
            ->addColumn('create_time','integer',['limit'=>10,'default'=>time(),'signed'=>false])
            ->create();
    }
    public function down(){
        $this->dropTable('user_tag');
    }
}
